#ifndef _PAPI_POWER3_EVENTS_H
#define _PAPI_POWER3_EVENTS_H

/* 
* File:    power3_events.h
* CVS:     
* Author:  Haihang You
*          you@cs.utk.edu
* Mods:    <your name here>
*          <your email address>
*/

#include "papi.h"
#include SUBSTRATE

#define PAPI_MAX_NATIVE_EVENTS 256
#define MAX_NATNAME_MAP_INDEX 223

typedef struct PWR3_register {
   /* indicate which counters this event can live on */
   unsigned int selector;
   /* Buffers containing counter cmds for each possible metric */
   int counter_cmd[MAX_COUNTERS];
} PWR3_register_t;

typedef PWR3_register_t hwd_register_t;

typedef struct PWR3_native_map {
   /* native event name */
   char *name;
   /* real index in the native table */
   int index;
} PWR3_native_map_t;

typedef struct native_event_entry {
   /* description of the resources required by this native event */
   hwd_register_t resources;
   /* If it exists, then this is the name of this event */
   char *name;
   /* If it exists, then this is the description of this event */
   char *description;
} native_event_entry_t;

enum native_name {
   PNE_PM_CYC = 0x40000000,
   PNE_PM_INST_CMPL,
   PNE_PM_TB_BIT_TRANS,
   PNE_PM_INST_DISP,
   PNE_PM_LD_CMPL,
   PNE_PM_IC_MISS,
   PNE_PM_LD_MISS_L2HIT,
   PNE_PM_LD_MISS_EXCEED_NO_L2,
   PNE_NUSED,
   PNE_PM_ST_MISS_EXCEED_NO_L2,
   PNE_PM_BURSTRD_L2MISS_W_INT,
   PNE_PM_IC_MISS_USED,
   PNE_PM_DU_ECAM_RCAM_OFFSET_HIT,
   PNE_PM_GLOBAL_CANCEL_INST_DEL,
   PNE_PM_CHAIN_1_TO_8,
   PNE_PM_FPU0_BUSY,
   PNE_PM_DSLB_MISS,
   PNE_PM_LSU0_ISS_TAG_ST,
   PNE_PM_TLB_MISS,
   PNE_PM_EE_OFF,
   PNE_PM_BRU_IDLE,
   PNE_PM_SYNCHRO_INST,
   PNE_PM_CYC_1STBUF_OCCP,
   PNE_PM_SNOOP_L1_M_TO_E_OR_S,
   PNE_PM_ST_CMPLBF_AT_GC,
   PNE_PM_LINK_STACK_FULL,
   PNE_PM_CBR_RESOLV_DISP,
   PNE_PM_LD_CMPLBF_AT_GC,
   PNE_PM_ENTRY_CMPLBF,
   PNE_PM_BIU_ST_RTRY,
   PNE_PM_EIEIO_WT_ST,
   PNE_PM_I_1_ST_TO_BUS,
   PNE_PM_CRB_BUSY_ENT,
   PNE_PM_DC_PREF_STREAM_ALLOC_BLK,
   PNE_PM_W_1_ST,
   PNE_PM_LD_CI,
   PNE_PM_4MISS,
   PNE_PM_ST_GATH_BYTES,
   PNE_PM_DC_HIT_UNDER_MISS,
   PNE_PM_INTLEAVE_CONFL_STALLS,
   PNE_PM_DU1_REQ_ST_ADDR_XTION,
   PNE_PM_BTC_BTL_BLK,
   PNE_PM_FPU_SUCCESS_OOO_INST_SCHED,
   PNE_PM_FPU_LD_ST_ISSUES,
   PNE_PM_FPU_EXEC_FPSCR,
   PNE_PM_FPU0_EXEC_FSQRT,
   PNE_PM_FPU0_EXEC_ESTIMATE,
   PNE_PM_SNOOP_L2ACC,
   PNE_PM_DU0_REQ_ST_ADDR_XTION,
   PNE_PM_TAG_BURSTRD_L2MISS,
   PNE_PM_FPU_IQ_FULL,
   PNE_PM_BR_PRED,
   PNE_PM_ST_L1MISS,
   PNE_PM_LD_MISS_EXCEED_L2,
   PNE_PM_L2ACC_BY_RWITM,
   PNE_PM_ST_MISS_EXCEED_L2,
   PNE_PM_ST_COND_FAIL,
   PNE_PM_CI_ST_WT_CI_ST,
   PNE_PM_CHAIN_2_TO_1,
   PNE_PM_TAG_BURSTRD_L2MISS_W_INT,
   PNE_PM_FXU2_IDLE,
   PNE_PM_SC_INST,
   PNE_PM_2CASTOUT_BF,
   PNE_PM_BIU_LD_NORTRY,
   PNE_PM_RESRV_RQ,
   PNE_PM_SNOOP_E_TO_S,
   PNE_PM_IBUF_EMPTY,
   PNE_PM_SYNC_CMPLBF_CYC,
   PNE_PM_TLBSYNC_CMPLBF_CYC,
   PNE_PM_DC_PREF_L2_INV,
   PNE_DC_PREF_FILT_1STR,
   PNE_PM_ST_CI_PREGATH,
   PNE_PM_ST_GATH_HW,
   PNE_PM_LD_WT_ADDR_CONF,
   PNE_PM_TAG_LD_DATA_RECV,
   PNE_PM_FPU1_DENORM,
   PNE_PM_FPU1_CMPL,
   PNE_PM_FPU_FEST,
   PNE_PM_FPU_LD,
   PNE_PM_FPU0_FDIV,
   PNE_PM_FPU0_FPSCR,
   PNE_PM_LD_MISS_L1,
   PNE_PM_TAG_ST_L2MISS,
   PNE_PM_BRQ_FILLED_CYC,
   PNE_PM_TAG_ST_L2MISS_W_INT,
   PNE_PM_ST_CMPL,
   PNE_PM_TAG_ST_CMPL,
   PNE_PM_LD_NEXT,
   PNE_PM_ST_L2MISS,
   PNE_PM_TAG_BURSTRD_L2ACC,
   PNE_PM_CHAIN_3_TO_2,
   PNE_PM_UNALIGNED_ST,
   PNE_PM_CORE_ST_N_COPYBACK,
   PNE_PM_SYNC_RERUN,
   PNE_PM_3CASTOUT_BF,
   PNE_PM_BIU_RETRY_DU_LOST_RES,
   PNE_PM_SNOOP_L2_E_OR_S_TO_I,
   PNE_PM_FPU_FDIV,
   PNE_PM_IO_INTERPT,
   PNE_PM_DC_PREF_HIT,
   PNE_PM_DC_PREF_FILT_2STR,
   PNE_PM_PREF_MATCH_DEM_MISS,
   PNE_PM_LSU1_IDLE,
   PNE_PM_FPU0_DENORM,
   PNE_PM_LSU0_ISS_TAG_LD,
   PNE_PM_TAG_ST_L2ACC,
   PNE_PM_LSU0_LD_DATA,
   PNE_PM_ST_L2MISS_W_INT,
   PNE_PM_SYNC,
   PNE_PM_FXU2_BUSY,
   PNE_PM_BIU_ST_NORTRY,
   PNE_PM_CHAIN_4_TO_3,
   PNE_PM_DC_ALIAS_HIT,
   PNE_PM_FXU1_IDLE,
   PNE_PM_UNALIGNED_LD,
   PNE_PM_CMPLU_WT_LD,
   PNE_PM_BIU_ARI_RTRY,
   PNE_PM_FPU_FSQRT,
   PNE_PM_BR_CMPL,
   PNE_PM_DISP_BF_EMPTY,
   PNE_PM_LNK_REG_STACK_ERR,
   PNE_PM_CRLU_PROD_RES,
   PNE_PM_TLBSYNC_RERUN,
   PNE_PM_SNOOP_L2_M_TO_E_OR_S,
   PNE_PM_DEM_FETCH_WT_PREF,
   PNE_PM_FPU0_EXEC_FRSP_FCONV,
   PNE_PM_IC_HIT,
   PNE_PM_0INST_CMPL,
   PNE_PM_FPU_DENORM,
   PNE_PM_BURSTRD_L2ACC,
   PNE_PM_FPU0_CMPL,
   PNE_PM_LSU_IDLE,
   PNE_PM_BTAC_HITS,
   PNE_PM_STQ_FULL,
   PNE_PM_BIU_WT_ST_BF,
   PNE_PM_SNOOP_L2_M_TO_I,
   PNE_PM_FRSP_FCONV_EXEC,
   PNE_PM_BIU_ASI_RTRY,
   PNE_PM_CHAIN_5_TO_4,
   PNE_PM_DC_REQ_HIT_PREF_BUF,
   PNE_PM_DC_PREF_FILT_3STR,
   PNE_PM_3MISS,
   PNE_PM_ST_GATH_WORD,
   PNE_PM_LD_WT_ST_CONF,
   PNE_PM_LSU1_ISS_TAG_ST,
   PNE_PM_FPU1_BUSY,
   PNE_PM_FPU0_FMOV_FEST,
   PNE_PM_4CASTOUT_BUF,
   PNE_PM_ST_L1HIT,
   PNE_PM_FXU2_PROD_RESULT,
   PNE_PM_BTAC_MISS,
   PNE_PM_CBR_DISP,
   PNE_PM_LQ_FULL,
   PNE_PM_SNOOP_PUSH_INT,
   PNE_PM_EE_OFF_EXT_INT,
   PNE_PM_BIU_LD_RTRY,
   PNE_PM_FPU_EXE_FCMP,
   PNE_PM_DC_PREF_BF_INV,
   PNE_PM_DC_PREF_FILT_4STR,
   PNE_PM_CHAIN_6_TO_5,
   PNE_PM_1MISS,
   PNE_PM_ST_GATH_DW,
   PNE_PM_LSU1_ISS_TAG_LD,
   PNE_PM_FPU1_IDLE,
   PNE_PM_FPU0_FMA,
   PNE_PM_SNOOP_PUSH_BUF,
   PNE_PM_FXU0_PROD_RESULT,
   PNE_PM_BR_DISP,
   PNE_PM_MPRED_BR_CAUSED_GC,
   PNE_PM_SNOOP,
   PNE_PM_0INST_DISP,
   PNE_PM_FXU_IDLE,
   PNE_PM_6XX_RTRY_CHNG_TRTP,
   PNE_PM_EXEC_FMA,
   PNE_PM_ST_DISP,
   PNE_PM_DC_PREF_L2HIT,
   PNE_PM_CHAIN_7_TO_6,
   PNE_PM_DC_PREF_BLOCK_DEMAND_MISS,
   PNE_PM_2MISS,
   PNE_PM_DC_PREF_USED,
   PNE_PM_LSU_WT_SNOOP_BUSY,
   PNE_PM_IC_PREF_USED,
   PNE_PM_FPU0_FADD_FCMP_FMUL,
   PNE_PM_1WT_THRU_BUF_USED,
   PNE_PM_SNOOP_L2HIT,
   PNE_PM_BURSTRD_L2MISS,
   PNE_PM_RESRV_CMPL,
   PNE_PM_FXU1_PROD_RESULT,
   PNE_PM_RETRY_BUS_OP,
   PNE_PM_FPU_IDLE,
   PNE_PM_FETCH_CORR_AT_DISPATCH,
   PNE_PM_CMPLU_WT_ST,
   PNE_PM_FPU_FADD_FMUL,
   PNE_PM_LD_DISP,
   PNE_PM_ALIGN_INT,
   PNE_PM_2WT_THRU_BUF_USED,
   PNE_PM_CHAIN_8_TO_7,
   PNE_PM_DC_MISS,
   PNE_PM_DTLB_MISS,
   PNE_PM_ITLB_MISS,
   PNE_PM_LD_MISS_CYC,
   PNE_PM_BR_FINISH,
   PNE_PM_BR_MPRED,
   PNE_PM_FXU_CMPL,
   PNE_PM_FPU_CMPL,
   PNE_PM_LSU_EXEC,
   PNE_PM_LD_MISS_DC_SHR,
   PNE_PM_WR_HIT_SHR_KILL_BRC,
   PNE_PM_MCI_IDLE,
   PNE_PM_DPU_WT_IC_MISS,
   PNE_PM_4INST_DISP,
   PNE_PM_CMPLU_WT_UNF_INST,
   PNE_PM_FPU_WT,
   PNE_PM_SNOOP_RECV,
   PNE_PM_LS_EXEC,
   PNE_PM_ST_MISS,
   PNE_PM_LSU_CMPL,
   PNE_PM_STCX_SUCCESS,
   PNE_PM_LARX,
   PNE_PM_BR_MPRED_GC,
   PNE_PM_FPU_FMA,
   PNE_PM_BRU_FIN,
   PNE_PM_ST_MISS_L1
};

extern native_event_entry_t native_table[PAPI_MAX_NATIVE_EVENTS];
extern pm_info_t pminfo;
extern PWR3_native_map_t native_name_map[MAX_NATNAME_MAP_INDEX];

#endif
